<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>修改用户</title>
<link href="${rc.getContextPath()}/resources/css/common.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="${rc.getContextPath()}/resources/js/jquery.js"></script>
<script type="text/javascript" src="${rc.getContextPath()}/resources/js/common.js"></script>
<script type="text/javascript" src="${rc.getContextPath()}/resources/js/jquery.validate.js"></script>
<script type="text/javascript" src="${rc.getContextPath()}/resources/js/messages_cn.js"></script>
<script type="text/javascript" src="${rc.getContextPath()}/resources/js/input.js"></script>
 <!-- 引入弹出JS begin -->
<script type="text/javascript" src="${rc.getContextPath()}/js/lhgdialog/lhgdialog.min.js?self=true"></script>
<!-- 引入弹出JS end -->
<script type="text/javascript">
jQuery.validator.addMethod("validPassword", function(value, element) { 
	 
	if($("#password").val()== value){
		return true;
	}else{
		return false;
	}
 
}, "2次输入的密码不同，请重新输入"); 

	$(document).ready(function(){
		var $inputForm = $("#inputForm");
		
		// 表单验证
		$inputForm.validate({
			errorClass: "fieldError",
			rules: {
				oldPassword: {
					required:true,
					remote: {
	                    type: "post",
	                    url: "${rc.getContextPath()}/user/admin/ajaxPassword.html",
	                    data: {
	                    	oldPassword: function() {
	                            return $("#oldPassword").val();
	                        },
	                        registName:function() {
	                            return $("#registName").val();
	                        }
	                    },
	                    dataType: "html",
	                    dataFilter: function(data, type) {
	                    	eval("var data  = "+data+";");
	                        if (data.msg == "true")
	                            return "true";
	                        else
	                            return "密码错误，请重新输入";
	                        
	                    }
	                }
					
				},
				password: "required",
				password2: {
					required:true,
					validPassword:true
				
				}
			}
		});
	});
	function trim(str){ 
		  return str.replace(/^\s+|\s+$/g,''); 
	} 
	function updateUser(){
		var form1 = $("#inputForm");
		form1.submit();
	}
	function back(){
		$.dialog.tips("返回中,请稍等...",600,"loading.gif");
		window.location.href='list.html ';
	}
</script>
</head>

<body>






<div class="path">
		  <a href="#"> 修改用户</a>
	</div>
	
	<form id="inputForm" action="${base!}/user/admin/updateUserPassword.html" method="post">
 
		<input type="hidden" id="userId" name="userId" value="${user.userId}"/>
		<input type="hidden" id="registName" name="registName" value="${user.registName}"/>
		<!-- 基本功能begin -->
		<table class="input tabContent">
			 
 

			<tr >
				<th>
					<span class="requiredField">*</span>用户名:
				</th>
				
				<td>
					<input  type="text"   name= "registName" disabled="disabled"  value="${user.registName}"/>
				
				</td>
			<tr >
				<th>
					<span class="requiredField">*</span>请输入原密码:
				</th>
				<td   >
					<input  type="password" id="oldPassword"  name= "oldPassword"  />
				
				</td>
			
			</tr>
			
			<tr>
				<th>
					<span class="requiredField">*</span>请输入密码:
				</th>
				<td >
						<input  type="password"  value="" name= "password" id= "password" />
				</td>
				
			</tr>

			<tr>
				<th>
					<span class="requiredField">*</span>请再次输入密码:
				</th>
				<td >
						<input  value="" type="password"  name= "password2"  /> 
				</td>
				
			</tr>
		</table>
		<table class="input">
			<colgroup>
				<col  width="15%"/>
				<col  width="35%"/>
				<col  width="15%"/>
				<col  width="35%"/>
			</colgroup>
			<tr>
				<td>

				</td>
				<td colspan="3">
					<input type="button" class="button" value="保存"  onclick="updateUser()"/>
					<input type="button" id="backButton" class="button" value="返回" onclick="javascript:back()" />
				</td>
			</tr>
		</table> 
	</form>
</body>
</html>